//
// Created by sjjmw on 1/24/2022.
//

#ifndef LEETCODE__11_H
#define LEETCODE__11_H
#include "base.h"
class Solution {
public:
    int maxArea(vector<int>& height) {
        int i=0,j=height.size()-1;
        int max_a=0;
        while(j-i>0){
            max_a=max(max_a,
                    min(height[j],height[i])*(j-i));
            if(height[j]>height[i]){
                i++;
            }else{
                j--;
            }
        }
        return max_a;
    }
};
#endif //LEETCODE__11_H
